document.addEventListener('DOMContentLoaded', function () {
    const advancedSearchLink = document.querySelector('.advanced-search');
    const filterContainer = document.getElementById('filter-container');

    advancedSearchLink.addEventListener('click', function (event) {
        event.preventDefault(); // 阻止链接的默认行为
        if (filterContainer.style.display === 'none') {
            filterContainer.style.display = 'block';
        } else {
            filterContainer.style.display = 'none';
        }
    });

    const tabs = document.querySelectorAll('.tab');
    const tabContents = document.querySelectorAll('.tab-content');

    tabs.forEach(tab => {
        tab.addEventListener('click', () => {
            // 移除所有 tab 的 active 类
            tabs.forEach(t => t.classList.remove('active'));
            // 添加当前 tab 的 active 类
            tab.classList.add('active');

            // 隐藏所有 tab 内容
            tabContents.forEach(content => content.classList.remove('active'));
            // 显示对应 tab 的内容
            const targetContent = document.getElementById(tab.dataset.tab);
            targetContent.classList.add('active');
        });
    });
});
